package fr.umlv.m2.jee.spij.persistence.education;

import org.hibernate.annotations.Columns;
import org.hibernate.annotations.Type;
import org.joda.time.Interval;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;

/**
 * Superclass Education who contain information about teaching.
 *
 * @author Lounes Akroune
 * @author Aurelien Scelles
 */
@MappedSuperclass
public abstract class Education implements Serializable {

    /**
     * Instructional time.
     *
     * @see org.joda.time.contrib.hibernate.PersistentInterval
     */
    @Columns(columns = {@Column(name = "EDU_START_DURATION"),
            @Column(name = "EDU_END_DURATION")})
    @Type(type = "org.joda.time.contrib.hibernate.PersistentInterval")
    private Interval duration;

    /**
     * About teaching.
     */
    @Column(name = "EDU_SUBJECT", nullable = true)
    private String subject;

    /**
     * Setter of Subject.
     *
     * @param newSubject the new subject to set.
     */
    public final void setSubject(final String newSubject) {
        this.subject = newSubject;
    }

    /**
     * @return subject the education subject.
     */
    public final String getSubject() {
        return subject;
    }

    /**
     * @param newDuration the new duration to set.
     */
    public final void setDuration(final Interval newDuration) {
        this.duration = newDuration;
    }

    /**
     * @return duration the education duration.
     */
    public final Interval getDuration() {
        return duration;
    }

}
